<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<title>FLDCMS后台管理系统</title>
<meta name="keywords" content="FLDCMS，FLDCMS后台管理系统">
<meta name="description" content="FLDCMS，是一款由FLD开发的轻量级扁平化网站后台模板，适合中小型CMS后台系统。">
{include file="public/header" /}
</head>
<body>
<article class="page-container">
	<form action="{:Url('/Admin/resetPwd')}" method="post" class="form form-horizontal" id="form-add">
		<input type="hidden" name="form_submit" value="ok"/>
		<input type="hidden" name="admin_id" id="admin_id" value="{$vo.admin_id}"/>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">账号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				{$vo.admin_name}
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>旧密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="password" class="input-text" value="" placeholder="请填写旧密码" id="old_pwd" name="old_pwd">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>新密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="password" class="input-text" value="" placeholder="请填写新密码" id="pwd" name="pwd">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>确认密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="password" class="input-text" value="" placeholder="请填写确认密码" id="confirm_pwd" name="confirm_pwd">
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button class="btn btn-secondary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
			</div>
		</div>
	</form>
</article>
{include file="public/footer" /}
<script type="text/javascript">
$(function(){
	
	$("#form-add").validate({
		rules:{
			old_pwd : {
				remote: {
				    url: "{:url('admin/checkPwd_ajax')}",    //后台处理程序
				    type: "post",               //数据发送方式
				    dataType: "json",           //接受数据格式   
				    data: {                     //要传递的数据
				    	old_pwd: function() {
				            return $("#old_pwd").val();
				        },
				        admin_id: function() {
				            return $("#admin_id").val();
				        },
				    }
				}
			},
			pwd:{
				required:true,
				minlength:6,
				maxlength:20,
			},
			confirm_pwd:{
				equalTo:"#pwd",
			}
		},
		messages: {
			old_pwd : {
				remote:'旧密码错误',
			},
			pwd:{
				required:'新密码不能为空',
				minlength:'新密码必须在6-20个字符之间',
				maxlength:'新密码必须在6-20个字符之间',
			},
			confirm_pwd:{
				equalTo:'确认密码和新密码不一致',
			}
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit({
                dataType:"json",
                success:function(data){
                   if(data.error == 0){
                	   	layer.msg(data.msg, {icon: 1,time: 1000}, function(){
                	   		var index = parent.layer.getFrameIndex(window.name);
                			parent.location.reload();
               				parent.layer.close(index);
                		});
                   }else{
                	   layer.msg(data.msg,{icon:2,time:1000});
                   }
                }
            });
		}
	});
});

</script>
</body>
</html>